import upload from '@/utils/upload'
import request from '@/utils/request'

// 用户密码重置
export function updateUserPwd(data) {

  return request({
    url: '/sys/user/editUser',
    method: 'post',
    params: data
  })
}

// 查询用户个人信息
export function getUserProfile() {
  return request({
    url: '/system/user/profile',
    method: 'get'
  })
}



// 微信免登陆
export function getLoginRequired(code) {
  return request({
    url: '/login/required',
    method: 'post',
	params: code
  })
}

// 修改用户个人信息
export function updateUserProfile(data) {
  return request({
    url: '/system/user/profile',
    method: 'put',
    data: data
  })
}

// 图片上传
export function uploadImgFile(data,data1) {
  return upload({
    url: '/image/addpicture',
	  filePath: data.filePath,
	  params:data1
  })
}


// 用户头像上传
export function uploadAvatar(data) {
  return upload({
    url: '/sys/user/avatar',
	 method: 'post',
     filePath: data.filePath,
  })
}

// 新增供应商注册信息 
export function addSave(data) {
  return request({
    url: '/supplier/regist/adds',
    method: 'post',
    data: data
  })
}

/**
 * @param {Object} data
 * 查询供应商列表
 */
export function datatableSupplier(data){
  return request({
    url: '/sup/info/datatable',
    method: 'post',
    params: data
  })
}

/**
 * @param {Object} data
 * 查询供应商审核
 */
export function examineSupplier(data) {
  return request({
    url: '/supplier/regist/datatable',
    method: 'post',
    params: data
  })
}
/**
 * @param {Object} rowId
 * @param {Object} data
 * 修改审核状态
 */
export function examineSupplierRowId(rowId,data) {
  return request({
    url: '/supplier/examineSupplier/examine/'+rowId,
    method: 'post',
    params: data
  })
}

/**
 * @param {Object} data
 * 查询所有合同信息
 */
export function ProcurementContractTable(data) {
  return request({
    url: '/contract/procurement/datatable',
    method: 'post',
    params: data
  })
}
/**
 * @param {Object} data
 * 查询合同采购明细
 */
export function materialInventoryTable(rowId) {
  return request({
    url: '/contract/procurement/materialInventoryTable/'+rowId,
    method: 'post',
    params: rowId
  })
}
/**
 * @param {Object} data
 * 查询审批内容
 */
export function reviewFormDatatable(data) {
  return request({
    url: '/contract/review/datatable',
    method: 'post',
    params: data
  })
}
/**
 * @param {Object} data
 * 审核权限验证
 */
export function reviewFormEditUI(rowId) {
  return request({
    url: '/contract/review/editUIApp/'+rowId,
    method: 'post',
    params: rowId
  })
}
/**
 * @param {Object} rowId
 * 获取合同审批流程明细数据
 */
export function reviewProcessTable(rowId) {
  return request({
    url: '/contract/material/datatable?contractId='+rowId,
    method: 'post',
    params: rowId
  })
}


export function ReviewProcessFormReviewId(rowId) {
  return request({
    url: '/contract/process/datatable?reviewId='+ rowId,
    method: 'post',
    params: rowId
  })
}
/**
 *
 * 审批通过方法
 */
export function editSave(data) {
  return request({
    url: '/contract/process/edit',
    method: 'post',
    data: data
  })
}

/**
 * @param {Object} rowId
 * @param {Object} approvalOpinions
 * 驳回方法
 */
export function goBack(rowId,approvalOpinions) {
	const data = {
	  rowId,
	  approvalOpinions
	}
  return request({
    url: '/contract/process/goBack',
    method: 'post',
    params: data
  })
}
/**
 * @param {Object} data
 * 查询比价单
 */
export function OrderCompareFormDatatable(data) {
  return request({
    url: '/pu/compare/datatable',
    method: 'post',
    params: data
  })
}

/**
 * @param {Object} rowId
 * 比价单明细
 */
export function OrderCompareDatatableItem(rowId) {
  return request({
    url: '/pu/compare/datatableItem?compareId='+rowId,
    method: 'post',
    params: rowId
  })
}

/**
 * @param {Object} data
 * 获取比价审核分页数据
 */
export function WorkCheckDatatable(data) {
  return request({
    url: '/wk/check/datatable',
    method: 'post',
    params: data
  })
}

/**
 * @param {Object} data
 * 查询审批单流程
 */
export function WorkCheckFlowFormDatatable(rowId) {
  return request({
    url: '/wk/flow/datatable?checkOrderId='+rowId,
    method: 'post',
    params: rowId
  })
}

//加载采购比价单
export function OrderCompareFormSourceId(sourceId) {
  return request({
    url: '/pu/compare/datatable?rowId='+sourceId,
    method: 'post',
    params: sourceId
  })
}



//查询审批
export function editUIAPPWorkCheckOrderForm(rowId){
  return request({
    url: '/wk/check/editAppUI/'+rowId,
    method: 'post',
    params: rowId
  })
}


//查询审批
export function editSaveForm(data) {
  return request({
    url: '/wk/flow/edit',
    method: 'post',
    data: data
  })
}

//查询审批
export function goBackSaveForm(rowId,optDesc) {
	const data = {
	  rowId,
	  optDesc
	}
  return request({
    url: '/wk/flow/goBack',
    method: 'post',
    params: data
  })
}



//查询审批
export function QuotationFormDatatable(data) {
  return request({
    url: '/inq/quotation/datatable',
    method: 'post',
    params: data
  })
}

/**
 * @param {Object} data
 * 查询物料列表
 */
export function oMDatatable(data) {
  return request({
    url: '/inq/offerMaterial/datatable',
    method: 'post',
    params: data
  })
}

/**
 * @param {Object} data
 * 查询报价轮次
 */
export function qtItemDatatable(data) {
  return request({
    url: '/inq/quotationItem/datatable',
    method: 'post',
    params: data
  })
}


export function qtItemaddSave(data) {
  return request({
    url: '/inq/quotationItem/addFrom',
    method: 'post',
    data: data
  })
}

export function qtItemaddEdit(data) {
  return request({
    url: '/inq/quotationItem/edit',
    method: 'post',
    params: data
  })
}

export function qtItemaddEditFrom(data) {
  return request({
    url: '/inq/quotationItem/editFrom',
    method: 'post',
    data: data
  })
}

/**
 * @param {Object} rowId
 * 修改参与
 */

export function quotationEditrowId(rowId) {
  return request({
    url: '/inq/quotation/abate/'+rowId,
    method: 'post',
    params: rowId
  })
}
/**
 * @param {Object} data
 * 查询升降级审核
 */
export function SurScoreFormDatatable(data) {
  return request({
    url: '/base/supplier/scoreReview/datatable',
    method: 'post',
    params: data
  })
}

/**
 * @param {Object} rowId
 * 查询评分信息
 */
export function SurScoreFormRowId(rowId) {
  return request({
    url: '/base/supplier/scoreReview/supplierScoreLineTable/'+rowId,
    method: 'post',
    params: rowId
  })
}

/**
 * @param {Object} rowId
 * @param {Object} SupplierScoreForm
 * 评分审核
 */
export function examineRowId(rowId,SupplierScoreForm) {
	
  return request({
    url: '/base/supplier/scoreReview/examine/'+rowId,
    method: 'post',
    params: SupplierScoreForm
  })
}

/**
 * @param {Object} data
 * 获取分组信息
 */
export function SlierGroupFormDatatable(data) {
  return request({
    url: '/lookup/supplierGroup/datatable',
    method: 'Post',
    params: data
  })
}



export function ProcurePersonFormDatatable(data) {
  return request({
    url: '/lookup/procurePerson/datatable',
    method: 'Post',
    params: data
  })
}

/**
 * @param {Object} data
 * 查询图片
 */
export function DocumentFormDatatable(code,docLabel) {
  return request({
    url: '/base/document/datatable?code='+code+'&docLabel='+docLabel,
    method: 'Post',
    // params: data
  })
}
/**
 * @param {Object} rowId
 * 查询设备
 */
export function supplierFormViewRowId(rowId) {
  return request({
    url: '/sup/info/viewRowId/'+rowId,
    method: 'Post',
    params: rowId
  })
}



